# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Drive.V3.Model.DriveBackgroundImageFile do
  @moduledoc """
  An image file and cropping parameters from which a background image for this shared drive is set. This is a write only field; it can only be set on `drive.drives.update` requests that don't set `themeId`. When specified, all fields of the `backgroundImageFile` must be set.

  ## Attributes

  *   `id` (*type:* `String.t`, *default:* `nil`) - The ID of an image file in Google Drive to use for the background image.
  *   `width` (*type:* `number()`, *default:* `nil`) - The width of the cropped image in the closed range of 0 to 1. This value represents the width of the cropped image divided by the width of the entire image. The height is computed by applying a width to height aspect ratio of 80 to 9. The resulting image must be at least 1280 pixels wide and 144 pixels high.
  *   `xCoordinate` (*type:* `number()`, *default:* `nil`) - The X coordinate of the upper left corner of the cropping area in the background image. This is a value in the closed range of 0 to 1. This value represents the horizontal distance from the left side of the entire image to the left side of the cropping area divided by the width of the entire image.
  *   `yCoordinate` (*type:* `number()`, *default:* `nil`) - The Y coordinate of the upper left corner of the cropping area in the background image. This is a value in the closed range of 0 to 1. This value represents the vertical distance from the top side of the entire image to the top side of the cropping area divided by the height of the entire image.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :id => String.t() | nil,
          :width => number() | nil,
          :xCoordinate => number() | nil,
          :yCoordinate => number() | nil
        }

  field(:id)
  field(:width)
  field(:xCoordinate)
  field(:yCoordinate)
end

defimpl Poison.Decoder, for: GoogleApi.Drive.V3.Model.DriveBackgroundImageFile do
  def decode(value, options) do
    GoogleApi.Drive.V3.Model.DriveBackgroundImageFile.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Drive.V3.Model.DriveBackgroundImageFile do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
